//
//  LYCoinsRechargeItemCell.m
//  Btpin
//
//  Created by liuyan on 2019/4/22.
//  Copyright © 2019年 Vic. All rights reserved.
//

#import "LYCoinsRechargeItemCell.h"

@interface LYCoinsRechargeItemCell()

@property (nonatomic, strong) UIView *backView;
@property (nonatomic, strong) UIImageView *selectImage;
@property (nonatomic, strong) UILabel *coinsLabel;
@property (nonatomic, strong) UILabel *moneyLabel;

@end

@implementation LYCoinsRechargeItemCell

- (void)setData:(NSDictionary *)dic isSelect:(BOOL)isSelect{
    if (!_backView) {
        _backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, (WIDTH - 45)/2, 70)];
        _backView.backgroundColor = [UIColor whiteColor];
        _backView.layer.borderWidth = 1;
        [self.contentView addSubview:_backView];
    }
    
    if (!_selectImage) {
        _selectImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.width-11, 1, 10, 10)];
        _selectImage.image = [UIImage imageNamed:@"selsected"];
        [self.contentView addSubview:_selectImage];
    }
    
    if (!_coinsLabel) {
        _coinsLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10  , _backView.width, 30)];
        _coinsLabel.font = [UIFont boldSystemFontOfSize:16];
        _coinsLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_coinsLabel];
    }
    
    if (!_moneyLabel) {
        _moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, _coinsLabel.bottom , _backView.width, 20)];
        _moneyLabel.font = [UIFont boldSystemFontOfSize:16];
        _moneyLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_moneyLabel];
    }

    
    if (isSelect) {
        _backView.layer.borderColor = [UIColor orangeColor].CGColor;
        _selectImage.hidden = NO;
        _coinsLabel.textColor = [UIColor orangeColor];
        _moneyLabel.textColor = [UIColor orangeColor];
    }else{
         _backView.layer.borderColor = RGB(153, 153, 153).CGColor;
        _selectImage.hidden = YES;
        _coinsLabel.textColor = RGB(85, 85, 85);
        _moneyLabel.textColor = RGB(153, 153, 153);
    }
    _coinsLabel.text = [NSString stringWithFormat:@"%ld聘豆", (long)[dic[@"coins"] integerValue]];
    _moneyLabel.text = [NSString stringWithFormat:@"%ld元", (long)[dic[@"price"] integerValue]];
}

@end
